using Sustainalytics.ESG.Entities;
using Sustainalytics.Synchronization.Validation.ValidationRules.Common;

namespace Sustainalytics.Synchronization.Validation.ValidationRules.Comprehensive
{
    public class ScoreChangeYellowRule : ComprehensivePercentChangeBetween<RPCompanyESGComputationResult>
    {
        public override Severity Severity => Severity.Yellow;
        public override BusinessResearchProduct BusinessResearchProduct => BusinessResearchProduct.Comprehensive;
        public override string Code => "YR2";
        public override string InformationalMessage => "Significant company score changes > Overall Score changes between 20% and 49.(9)%";

        public ScoreChangeYellowRule()
            : base(0.2, 0.5)
        {
            For(x => x.OverallPerformance.Score).When((validatedEntity, referenceEntity) => !Validator(validatedEntity, referenceEntity))
                .WithKey(x => x.Id)
                .WithMessage("The company {0} #{1}#has Overall Score changes between 20% and 49.9%");
        }
    }
}
